package cn.edu.zut.dao;

import cn.edu.zut.domain.News;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface NewsDao {
    //查询所有新闻
    @Select("select * from news")
    public List<News> findAll();
    //填加新闻
    @Insert("insert into news(_id,contestId,head,date,brief,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12)" +
            " values(#{_id},#{contestId},#{head},#{date},#{brief},#{t0},#{t1},#{t2},#{t3},#{t4},#{t5},#{t6},#{t7},#{t8},#{t9},#{t10},#{t11},#{t12})")
    public void insertOne(News news) throws Exception;
    //根据_id删除新闻
    @Delete("delete from news where _id = #{_id}")
    public void deleteById(int _id);
}
